<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends CommonController {
    public function index(){
        $this->display();
    }

    public function checklogin()
    {
        $username = I('post.username');
        $password = md5(I('post.password'));

        if($res =M('admin')->where("username='$username' and password='$password'")->find()){
            
            $_SESSION['admin_uid'] = $res['id'];
            $_SESSION['username'] = $res['username'];
            $this->log('登录成功');
            Reajax(0,'登录成功');

        }else{
            Reajax(1,'帐号或者密码不对');
        }
    }

    public function old()
    {
        echo "888";
    }
    
}